@echo off

:: AIR application packaging
:: More information:
:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959

:: Path to Flex SDK binaries
set PATH=%PATH%;"C:\sdks\AIR SDK\AIR1.5\bin"

:: Signature
set CERTIFICATE="../../../../../../Security/AIRcert.p12"
set SIGNING_OPTIONS=-storetype pkcs12 -keystore %CERTIFICATE%
if not exist %CERTIFICATE% goto certificate

:: Output
set AIR_FILE=../bin/MyAvatarEditor.air

:: Input
set APP_XML=application.xml 
set FILE_OR_DIR=icons -C ../bin myavatareditor.swf myavatarcharacter.swf

echo Signing AIR setup using certificate %CERTIFICATE%.
call adt -package %SIGNING_OPTIONS% %AIR_FILE% %APP_XML% %FILE_OR_DIR%
if errorlevel 1 goto failed

echo.
echo AIR setup created: %AIR_FILE%
echo.
goto end

:certificate
echo Certificate not found: %CERTIFICATE%
echo.
echo Troubleshotting: 
echo A certificate is required.
echo.
goto end

:failed
echo AIR setup creation FAILED.
echo.
echo Troubleshotting: 
echo Did you configure the Flex SDK path in this Batch file?
echo.

:end
pause
